<?php 
class GoodsListModel extends Model{
	public $table="goodslist";
	public $validate=array(
//	   array("combin[]","nonull","请选择规格",2,3),
	   array("inventory",'nonull',"请填写库存",2,3),
	);
	
	public function addlist(){
		if(!$this->create()) return false;
		$this->data['combinnum']=$this->data['combin'];
		$this->data['combin']=implode(",", $this->data['combin']);
		
		$this->data['combinnum']=implode("", $this->data['combinnum']);
		$this->data['number']=$this->data['goods_gid'].$this->data['combinnum'];
		$qc=K("goodslist")->where("number={$this->data['number']}")->find();
		if($qc){
			$this->error="添加重复";
			return false;
		}else{
			$this->add();
		}

		
		return true;
	}
	
	public function editlist(){
		if(!$this->create()) return false;
		$this->data['combin']=implode(",", $this->data['combin']);
//		p($this->data);die;
		$this->update();
		return true;
		
		
	}
	
	
	
	
	
	
}





 ?>